//
//  AvoidCrash.h
//  LzlPictureBrower
//
//  Created by luozhilin on 2018/6/5.
//  Copyright © 2018年 luozhilin. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

#define AvoidCrashVersion(version) ([[UIDevice currentDevice].systemVersion floatValue] >= version)
//user can ignore below define
#define AvoidCrashDefaultReturnNil  @"AvoidCrash default is to return nil to avoid crash."
#define AvoidCrashDefaultIgnore     @"AvoidCrash default is to ignore this operation to avoid crash."

#define AvoidCrashSeparator         @"================================================================"
#define AvoidCrashSeparatorWithFlag @"========================AvoidCrash Log=========================="

#ifdef DEBUG
#define  YYAvoidCrashLog(...) NSLog(@"%@",[NSString stringWithFormat:__VA_ARGS__])
#else
#define YYAvoidCrashLog(...)
#endif

@interface YYAvoidCrash : NSObject

+ (void)becomeEffective;

+ (void)makeAllEffective;

+ (void)setupNoSelClassAvoidCrashWithClassNameArray:(NSArray <NSString *>*)classArray;

+ (void)setupNoSelClassAvoidCrashWithPrefixClassNameArray:(NSArray <NSString *> *)prefixClassArray;

// 替换系统方法
+ (void)exchangeClassMethod:(Class) originalClass originalMethod:(SEL)originalSel newMethod:(SEL)newMethod;

+ (void)exchangeInstanceMethod:(Class) originalClass originalMethod:(SEL)originalSel newMethod:(SEL)newMethod;

+ (void)errorMessageWithException:(NSException *)exception defaultToDo:(NSString *)defaultToDo;
@end
